package com.work.demo.file;

import java.nio.ByteBuffer;

public class FileIO {


	public static void main(String[] args) {


		ByteBuffer allocate = ByteBuffer.allocate(1024);

		System.out.println("position:" + allocate.position());
		System.out.println("limit:" + allocate.limit());


		allocate.put("1234".getBytes());

		System.out.println("position:" + allocate.position());
		System.out.println("limit:" + allocate.limit());

		allocate.flip();
		System.out.println("position:" + allocate.position());
		System.out.println("limit:" + allocate.limit());

		allocate.get();
		allocate.get();
//		System.out.println(b);
		System.out.println("position:" + allocate.position());
		System.out.println("limit:" + allocate.limit());
		System.out.println(allocate.toString());
	}

}
